﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package reprise.tweens {

    public class TweenedPropertyVO {

        public var targetValue:Number;
        public var valueChange:Number;
        public var roundResults:Boolean;
        public var scope:Object;
        public var property:String;
        public var startValue:Number;
        public var propertyIsMethod:Boolean;
        private var m_easingFunction:Function;
        public var extraParams:Array;

        public function TweenedPropertyVO(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Function=null, _arg6:Boolean=false, _arg7:Boolean=false, _arg8:Array=null){
            this.scope = _arg1;
            this.property = _arg2;
            this.extraParams = ((_arg8) || ([]));
            if (isNaN(_arg3)){
                this.startValue = _arg1[_arg2];
            } else {
                this.startValue = _arg3;
            };
            this.targetValue = _arg4;
            this.roundResults = _arg6;
            valueChange = (_arg4 - _arg3);
            if (_arg5 != null){
                m_easingFunction = _arg5;
            };
            setPropertyType(_arg7);
        }
        public function tweenFunction(_arg1:int, _arg2:Number, _arg3:Number, _arg4:int, ... _args):Number{
            if (m_easingFunction != null){
                return (m_easingFunction.apply(null, [_arg1, _arg2, _arg3, _arg4].concat(_args)));
            };
            return ((((_arg3 * _arg1) / _arg4) + _arg2));
        }
        public function reverse():void{
            var _local1:Number = startValue;
            startValue = targetValue;
            targetValue = _local1;
            valueChange = (targetValue - startValue);
        }
        public function setPropertyType(_arg1:Boolean):void{
            if (_arg1){
                propertyIsMethod = true;
            } else {
                propertyIsMethod = false;
            };
        }
        protected function tweenPropertyAsProperty(_arg1:int, _arg2:int):void{
            var _local3:Array = [_arg2, startValue, valueChange, _arg1].concat(extraParams);
            var _local4:Number = tweenFunction.apply(null, _local3);
            scope[property] = (roundResults) ? Math.round(_local4) : _local4;
        }
        public function tweenProperty(_arg1:int, _arg2:int):void{
            if (propertyIsMethod){
                tweenPropertyAsMethod(_arg1, _arg2);
                return;
            };
            tweenPropertyAsProperty(_arg1, _arg2);
        }
        protected function tweenPropertyAsMethod(_arg1:int, _arg2:int):void{
            var _local3:Array = [_arg2, startValue, valueChange, _arg1].concat(extraParams);
            var _local4:Number = tweenFunction.apply(null, _local3);
            var _local5:Array = [(roundResults) ? Math.round(_local4) : _local4].concat(extraParams);
            (scope[property] as Function).apply(scope, _local5);
        }

    }
}//package reprise.tweens 
